#pragma once
#include "../public.h"

//Save TLBB terrain xml data

class CSceneData;
class CTerrainData
{
public:
	CTerrainData(CSceneData* pSceneData);
	~CTerrainData(void);
	
	//Load data from .terrain
	void LoadTerrainData(std::string& strFile);

	const Ogre::AxisAlignedBox& CTerrainData::getBoundBox() const;
private:
	void _LoadHeightMap();
	void _updateDerivedFields();

protected:
	CSceneData*		m_pSceneData;

	//terrain file name
	std::string		m_strTerrainFile;

	std::string		m_strName;
	u32				m_nTileSize;
	u32				m_nXSize;
	u32				m_nZSize;

	Ogre::Vector3	m_vec3Scale;	
	Ogre::Vector3	m_vec3Position;

	Ogre::Vector3   mInvScale;
	Ogre::Vector3	mCentre;

	Ogre::Real		mMinX;
	Ogre::Real		mMaxX;
	Ogre::Real		mMinZ;
	Ogre::Real		mMaxZ;

	Ogre::Real		mNumTilePerX;
	Ogre::Real		mNumTilePerZ;

	std::string		m_strHeightMapName;
	std::string		m_strHeightMapFormate;

	typedef std::vector<Real> RealArray;

	RealArray		m_vecHeightmap;


	Ogre::AxisAlignedBox	m_BoundBox;

};
